/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jobportal.college;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jobportal.Dbconn;

/**
 *
 * @author project
 */
public class StudentStatusVerify extends HttpServlet {
   
    /** 
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
     protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
         doPost(request, response);
     }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        PrintWriter out = response.getWriter();
         RequestDispatcher rd;
         rd = request.getRequestDispatcher("verify_student_profile.jsp");
        try {
            HttpSession session = request.getSession();
            Connection con = Dbconn.getConn();
            Statement st = con.createStatement();
            String dob,username, sql,statusvar;
            
            username=request.getParameter("username");
            statusvar=request.getParameter("statusvar");
            if(statusvar!=null&&statusvar.equals("Verify"))
                statusvar="Verified";
            sql = "update student set status='"+statusvar+"' where username='"+username+"'";
            st.executeUpdate(sql);
            rd.forward(request, response);
        }
        catch(Exception e)
        {
            out.println(e);
        }
    }
}
